package addon.w3.mdx.com;

import java.io.IOException;
import java.util.Vector;

import addon.w3.mdx.MDXCOM;
import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;
import addon.w3.mdx.MDXParentCOM;

/**
 * LAYS						// [Layer}
	long	nlays;
	struct {
		long	nbytesi;
		long	FilterMode;	(0:none;1:transparent;2:blend;3:additive;4:addalpha;5:modulate)
		long	Shading;		//+1:unshaded;+2:SphereEnvMap;+16:twosided;
		long	TextureID;              //  +32:unfogged;+64:NoDepthTest;+128:NoDepthSet)
		long 	TVertexAnimId;		// 0xFFFFFFFF if none
		long	CoordId;
		float	Alpha;			(0(transparent)->1(opaque))
		(KMTA)
		(KMTF)				// state is long not float
	} layers[nlays];
 * @author madjk
 *
 */
public class MDXLayer extends MDXParentCOM {
	int nlays = -1;
	
	public MDXLayerCOM lays[] = null;
	
	public String getTag() {
		return "LAYS";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		nlays = ins.readInt();
		lays = new MDXLayerCOM[nlays];
		for(int i=0;i<lays.length;i++) {
			lays[i] = new MDXLayerCOM();
			lays[i].decode(ins);
		}
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tNLAYS : "+nlays);
		if(lays != null && lays.length > 0) sb.append("\n\tCOMS[] : "+lays.length);
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return true;
	}
}